package com.efuture.chapterthree

/* @Description: 异常处理与自定义异常特定
 * @Auther: zhaoshanshan
 * @Date: 2022/03/04/11:12 下午
 */

fun main() {
    try{
      var name:String? = null

      checkException(name);

      println(name!!.length)
    }catch (e:Exception){
       // e.printStackTrace();
        println("异常:$e")
    }
}

fun checkException(name: String?) {

   name?:throw MySelfException();

}
class MySelfException : NullPointerException("你的代码太烂了")
    